package com.itmake.webflux.security.util;

import org.springframework.security.core.context.ReactiveSecurityContextHolder;
import org.springframework.security.core.context.SecurityContext;

/**
 * flux security 工具
 *
 * @author Amjacks
 * @since 2023/08/10
 */
public class FluxSecurityUtil {

    private FluxSecurityUtil() {}

    /**
     * 获取 Authentication
     */
    public static Object getAuthentication() {
        return ReactiveSecurityContextHolder.getContext().map(SecurityContext::getAuthentication).block();
    }
}
